package com.lanxiaoye.shoppingSystem.service.impl;

import com.lanxiaoye.shoppingSystem.dao.UserMapper;
import com.lanxiaoye.shoppingSystem.entity.User;
import com.lanxiaoye.shoppingSystem.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by Administrator on 2017/3/21.
 */
@Service
public class UserImpl implements UserService {
    @Autowired
    UserMapper userMapper;

    @Override
    public User getUserByName(String name) {
        return userMapper.selectByName(name);
    }

    @Override
    public User getUserByPhone(String phone) {
        return userMapper.selectByPhone(phone);
    }

    @Override
    public User getUserByEmail(String email) {
        return userMapper.selectByEmail(email);
    }

    @Override
    public User getUserById(int userId) {
        return userMapper.selectByPrimaryKey(userId);
    }

    @Override
    public int update(User user) {
        return userMapper.updateByPhoneSelective(user);
    }
}
